Describe using importlib-metadata as an alternative to pkg_resources for single-sourcing versions#706
Merged
pradyunsg merged 2 commits intopypa:masterfrom Mar 20, 2020
jwodder:importlib-resource
Merged
Describe using importlib-metadata as an alternative to pkg_resources for single-sourcing versions#706pradyunsg merged 2 commits intopypa:masterfrom jwodder:importlib-resource
pradyunsg merged 2 commits intopypa:masterfrom
jwodder:importlib-resource
Conversation
single-sourcing versions
xavfernandez
approved these changes
Mar 13, 2020
Member
xavfernandez
left a comment
There was a problem hiding this comment.
I think the importlib.metadata should be presented before the pkg_resources one.
pfmoore
approved these changes
Mar 13, 2020
Member
pfmoore
left a comment
There was a problem hiding this comment.
I agree with @xavfernandez, I'd be in favour of putting the importlib.metadata approach first.
Contributor
Author
|
@xavfernandez @pfmoore |
pfmoore
approved these changes
Mar 13, 2020
xavfernandez
approved these changes
Mar 13, 2020
Member
|
Thanks for the PR @jwodder, and the reviews @pfmoore and @xavfernandez! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item 5 in "Single-sourcing the package version" currently presents its approach using
pkg_resources. However,pkg_resourcesis inefficient (and possibly deprecated?), and more efficient & modern alternatives to it are being developed in the form ofimportlib.resourcesandimportlib.metadata. This PR extends item 5 to also show how to achieve the same thing usingimportlib.metadata. It also adds a note that thepkg_resourcesversion requiressetuptoolsas a runtime dependency.I expect there will be some debate over whether to present both methods side by side or whether to delete the
pkg_resourcesmethod in favor ofimportlib.metadata. I'm open to both possibilities.